package test;

import java.util.Scanner;

/**
 * @author 郝文雪
 * @date 2022/9/20 19:17
 * @Description Test
 */
public class 小米1 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        String t=sc.nextLine();
        int len1=s.length();
        int len2=t.length();
        int[][] dist=new int[len1+1][len2+1];
        for(int i=0;i<=len1;i++){
            dist[i][0]=i;
        }
        for(int j=0;j<=len2;j++){
            dist[0][j]=j;
        }
        for(int i=1;i<=len1;i++){
            for(int j=1;j<=len2;j++){

                if(s.charAt(i-1)==t.charAt(j-1)){
                    dist[i][j]=dist[i-1][j-1];
                }else{
                    dist[i][j]=Math.min(dist[i-1][j-1],Math.min(dist[i-1][j],dist[i][j-1]))+1;
                }
            }
        }
        System.out.println(dist[len1][len2]);
    }
}
